﻿@model IEnumerable<LojaVirtual.Comuns.Clientes.Compra>

@{
    ViewBag.Title = "Index";
}

<h2>Index</h2>

<table>
    <tr>
        <th>Cliente</th>
        <th>Qnt itens</th>
        <th>Total</th>
        <th>Status</th>
        <th>Data da compra</th>
        <th></th>
    </tr>

@foreach (var compra in Model) {
    <tr>
        <td>@Html.DisplayFor(modelItem => compra.Cliente.Nome)</td>

        <td>@Html.DisplayFor(modelItem => compra.Itens.Count)</td>
        <td>@Html.DisplayFor(modelItem => compra.Total)</td>
        <td>@(compra.PagamentoConfirmado ? "Pagamento Confirmado" : "Aguardando Pagamento")</td>

        <td>@Html.DisplayFor(modelItem => compra.DataEfetuada)</td>
        <td>
            @Html.ActionLink("Details", "Details", new { id=compra.ID }) |
            @Html.ActionLink("Delete", "Delete", new { id=compra.ID })
        </td>
    </tr>
}

</table>
